﻿@{
    Layout = null;
}
@using ZHJ.PerfectOA.Model
<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>SetActionRoleInfo</title>
    <script src="~/Scripts/jquery-1.8.2.min.js"></script>
    <script src="~/Scripts/jquery.unobtrusive-ajax.min.js"></script>

    <script>
        function subForm() {
            $("#addRoleForm").submit();
        }
        function afterAdd(data) {
            if (data=="ok") {
                window.parent.afterSetRoleq();
            }
            
        }
    </script>
</head>
<body>
    为
    @{
        ActionInfo actionInfo = ViewBag.ActionInfo;
        <span style="font-size:16px;color:red">@actionInfo.ActionInfoName</span>
    }权限分配角色
    @using (Ajax.BeginForm("SetActionRoleInfo", "ActionInfo", new { }, new AjaxOptions() { HttpMethod = "post", OnSuccess = "afterAdd" }, new { id = "addRoleForm" }))
    {
        <input type="hidden" name="actionId" value="@actionInfo.ID" />
        List<RoleInfo> AllRoleList = ViewBag.AllRoleList;
        List<int> AllRoleIdList = ViewBag.AllRoleIdList;
        foreach (RoleInfo roleInfo in AllRoleList)
        {
            string roleName = "cba_" + roleInfo.ID;
            if (AllRoleIdList.Contains(roleInfo.ID))
            {
                <input type="checkbox" checked="checked" name="@roleName" value="@roleInfo.ID" />@roleInfo.RoleName
            }
            else
            {
                <input type="checkbox" name="@roleName" value="@roleInfo.ID" />@roleInfo.RoleName
            }
        }
    }






</body>
</html>
